#ifndef MEASURE_SIZE_TRACKER_MOVE_VISITOR_H_
#define MEASURE_SIZE_TRACKER_MOVE_VISITOR_H_

#if defined(_MSC_VER)
#pragma once
#endif

#include "geometry_elements.h"
#include "boost\variant\static_visitor.hpp"
#include "boost\foreach.hpp"

class move_visitor : public boost::static_visitor<>
{
public:

  move_visitor(const vector_2 &delta)
    : delta_(delta)
  {
  }

  ~move_visitor(void)
  {
  }

public:

  void operator()(point_2& point) const
  {
    point += delta_;
  }

  void operator()(segment_2& segment) const
  {
    segment.start += delta_;
    segment.end   += delta_;
  }

  void operator()(box_2& box) const
  {
    box.top_left      += delta_;
    box.bottom_right  += delta_;
  }

  void operator()(angle_box_2& angle_box) const
  {
    point_2 center(angle_box.center_x, angle_box.center_y);

    center += delta_;

    angle_box.center_x = center.x;
    angle_box.center_y = center.y;
  }

  void operator()(ring_2& ring) const
  {
    point_2 center(ring.center_x, ring.center_y);

    center += delta_;

    ring.center_x = center.x;
    ring.center_y = center.y;
  }

  void operator()(arc_2& arc) const
  {
    point_2 center(arc.center_x, arc.center_y);

    center += delta_;

    arc.center_x = center.x;
    arc.center_y = center.y;
  }

  void operator()(annulus_2& annulus) const
  {
    point_2 center(annulus.center_x, annulus.center_y);

    center += delta_;

    annulus.center_x = center.x;
    annulus.center_y = center.y;
  }

  void operator()(annulus_arc_2& annulus_sector) const
  {
    point_2 center(annulus_sector.center_x, annulus_sector.center_y);

    center += delta_;

    annulus_sector.center_x = center.x;
    annulus_sector.center_y = center.y;
  }

  void operator()(polygon_2& polygon) const
  {
    BOOST_FOREACH(point_2& pt, polygon)
    {
      pt += delta_;
    }
  }

private:
  const vector_2 &delta_;
};

#endif // MEASURE_SIZE_TRACKER_MOVE_VISITOR_H_